package com.diaohw.module.auth.controller;

import com.diaohw.module.auth.service.LoginService;
import com.diaohw.platform.common.obj.login.LoginVo;
import com.diaohw.platform.framework.web.OperatorLog;
import com.diaohw.platform.remote.auth.obj.bo.AccountInfoBO;
import com.diaohw.platform.remote.auth.obj.bo.LoginBO;
import com.diaohw.platform.remote.auth.obj.bo.PasswordBO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@Tag(name = "登录管理")
@RestController
@RequestMapping("/login")
public class LoginController {

    @Resource
    LoginService loginService;

    @Operation(summary = "登录")
    @PostMapping
    @OperatorLog(request = false, enable = false, response = false)
    public LoginVo login(@RequestBody LoginBO login) {
        return loginService.login(login);
    }

    @Operation(summary = "重置密码")
    @PutMapping("/reset")
    @OperatorLog(request = false, enable = false, response = false)
    public boolean reset(@RequestBody PasswordBO password) {
        return loginService.reset(password);
    }

    @GetMapping("/me")
    @Operation(summary = "我的信息")
    public AccountInfoBO me() {
        return loginService.me();
    }


}
